package com.common.util;

import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpEntity;
import org.apache.http.client.HttpClient;

/**
 * @author zyl
 * @description
 * @since 2024/11/21
 */
public class httpUtils {
    public static String sendPost(String url, Object obj) {
        String result = "";
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            String s = objectMapper.writeValueAsString(obj);
            HttpEntity execute = CommonHttpRequest
                    .get(url)
                    .body(JSON.toJSONString(s))
                    .execute();
            return CommonHttpRequest.getResponseString(execute);
        }catch (Exception e){

        }
        return result;
    }
}
